package com.aaa.hospital.controller;

import com.aaa.hospital.aop.Log;
import com.aaa.hospital.pojo.domain.Resume;
import com.aaa.hospital.pojo.vo.DoctorVO;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.DoctorResumeService;
import com.aaa.hospital.util.OSSUtil;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ZQ on 2022/2/18
 */
@RestController
@RequestMapping("resume")
public class DoctorResumeController {

    @Autowired
    private DoctorResumeService doctorResume;
    @Autowired
    private OSSUtil ossUtil;

    @RequestMapping("oneName/{id}")
    public AjaxResult oneName(@PathVariable Integer id){

        return doctorResume.oneName(id);
    }

    @RequestMapping("getADoctor/{id}")
    public AjaxResult getADoctor(@PathVariable Integer id){

        return doctorResume.getADoctor(id);
    }

    @RequestMapping("addResume")
    @Log("添加简历")
    public AjaxResult addResume(Resume resume){
        return doctorResume.addResume(resume);
    }

    @RequestMapping("getId/{id}")
    public AjaxResult getId(@PathVariable Integer id){
        return doctorResume.getId(id);
    }

    @RequestMapping("getAvatar/{id}")
    public AjaxResult getAvatar(@PathVariable Integer id){
        return doctorResume.getAvatar(id);
    }

    @RequestMapping("updateAvatar")
    @Log("修改头像")
    public AjaxResult updateAvatar(DoctorVO doctorVO,MultipartFile headImg){
        String path = ossUtil.uploadOSS(headImg);
        doctorVO.setImgURL(path);

        return doctorResume.updateAvatar(doctorVO);
    }

    @RequestMapping("getInfoID")
    public AjaxResult getInfoID(){

        return doctorResume.getInfoID();
    }

    @RequestMapping("getDoctorResume/{id}")
    public AjaxResult getDoctorResume(@PathVariable Integer id){

        return doctorResume.getDoctorResume(id);
    }
    @RequestMapping("updateDoctorResume")
    public AjaxResult updateDoctorResume(Resume resume){

        return doctorResume.updateDoctorResume(resume);
    }


}
